package com.itany.corejava.code07_常用类.其他类;

import java.util.Random;

/**
 * @author MissChen
 * @date 2024年03月02日 11:20
 */
public class Test03_Random {
    public static void main(String[] args) {
        Random random=new Random();
        System.out.println(random.nextInt());
        System.out.println(random.nextLong());
        System.out.println(random.nextDouble());
        System.out.println(random.nextBoolean());
        //获取0-9的随机整数,随机获取一个[0,i)的整数,左闭右开
        System.out.println(random.nextInt(10));

        //获取15-32的随机整数
        // 32-15+1=18
        // 0-17
        System.out.println(random.nextInt(18)+15);
    }
}
